import { createRouter, createWebHistory } from 'vue-router'

// 公共路由-无权限
export const constantRoutes = [
  {
    path: '/test',
    name: 'home',
    component: () => import('@/views/main.vue')
  }
];
/*
  meta: {
    show: 当前路由显示在侧边栏
    isLink: 一级路由是否可以点击进行路由跳转
    reenter: 用来路由页面里判断是否需要重新加载或者读取任务详情
    exclude: 是否该路由不做缓存
  }
*/
// 动态路由-权限筛选
export const dynamicRoutes = [
  // 隐写模块
  // {
  //   path: '',
  //   component: () => import('@/components/layout/index.vue'),
  //   redirect: '/index',
  //   name: 'steganography',
  //   meta: { show: true, title: '隐写', isLink: false, icon: 'icon-home11' },
  //   children: [
  //     {
  //       path: '/index',
  //       name: 'extractList',
  //       component: () => import('@/views/steganography/index.vue'),
  //       meta: { show: true, title: '隐写提取任务', isLink: true, icon: 'icon-yaosutiqu' }
  //     },
  //     // 创建提取任务
  //     {
  //       path: '/createExtract',
  //       name: 'createExtract',
  //       component: () => import('@/views/steganography/createExtract.vue'),
  //       meta: { show: false, title: '创建隐写提取', isLink: true }
  //     },
  //     // 嵌入任务列表
  //     {
  //       path: '/implantList',
  //       name: 'implantList',
  //       component: () => import('@/views/steganography/implantList.vue'),
  //       meta: { show: true, title: '隐写嵌入任务', isLink: true, icon: 'icon-wenbenqianru' }
  //     },
  //     // 创建嵌入任务
  //     {
  //       path: '/createImplant',
  //       name: 'createImplant',
  //       component: () => import('@/views/steganography/createImplant.vue'),
  //       meta: { show: false, title: '创建隐写嵌入', isLink: true }
  //     }
  //   ]
  // },
  // 课题二
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/secondExtractList',
    name: 'secondSteg',
    meta: { show: true, title: '可证安全隐写算法模块', isLink: false, icon: 'icon-qianru' },
    children: [
      // 提取任务列表
      {
        path: '/secondExtractList',
        name: 'secondExtractList',
        component: () => import('@/views/second/extractList.vue'),
        meta: { show: true, title: '提取任务', isLink: true, icon: 'icon-yaosutiqu' }
      },
      // 创建提取任务
      {
        path: '/secondCreateExtract',
        name: 'secondCreateExtract',
        component: () => import('@/views/second/createExtract.vue'),
        meta: { show: false, title: '创建提取任务', isLink: true }
      },
      // 嵌入任务列表
      {
        path: '/secondImplantList',
        name: 'secondImplantList',
        component: () => import('@/views/second/implantList.vue'),
        meta: { show: true, title: '嵌入任务', isLink: true, icon: 'icon-wenbenqianru' }
      },
      // 创建嵌入任务
      {
        path: '/secondCreateImplant',
        name: 'secondCreateImplant',
        component: () => import('@/views/second/createImplant.vue'),
        meta: { show: false, title: '创建嵌入任务', isLink: true }
      }
    ]
  },
  // 公钥隐写
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/publicSteg',
    name: 'publicSteganography',
    meta: { show: true, title: '隐写隐蔽参数交换模块', isLink: false, icon: 'icon-shujutiqu1' },
    children: [
      // 提取任务列表
      {
        path: '/publicSteg',
        name: 'publicExtractList',
        component: () => import('@/views/publicSteg/index.vue'),
        meta: { show: true, title: '参数协商接收', isLink: true, icon: 'icon-yaosutiqu' }
      },
      // 创建提取任务
      {
        path: '/publicCreateExtract',
        name: 'publicCreateExtract',
        component: () => import('@/views/publicSteg/createExtract.vue'),
        meta: { show: false, title: '创建参数协商接收任务', isLink: true, reenter: true }
      },
      // 嵌入任务列表
      {
        path: '/publicImplantList',
        name: 'publicImplantList',
        component: () => import('@/views/publicSteg/implantList.vue'),
        meta: { show: true, title: '参数协商发送', isLink: true, icon: 'icon-wenbenqianru' }
      },
      // 创建嵌入任务
      {
        path: '/publicCreateImplant',
        name: 'publicCreateImplant',
        component: () => import('@/views/publicSteg/createImplant.vue'),
        meta: { show: false, title: '创建参数协商发送任务', isLink: true, reenter: true }
      }
    ]
  },
  // 课题四
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/fout',
    name: 'four',
    meta: { show: true, title: '隐写行为一致性耦合模块', isLink: false, icon: 'icon-qianrushiwaiweiIC' },
    children: [
      {
        path: '/person',
        name: 'person',
        component: () => import('@/views/four/person.vue'),
        meta: { show: true, title: '个性化推荐', isLink: true, icon: 'icon-yonghu' }
      },
      {
        path: '/group',
        name: 'group',
        component: () => import('@/views/four/group.vue'),
        meta: { show: false, title: '群组推荐', isLink: true, icon: 'icon-yonghu1' }
      },
      {
        path: '/generate',
        name: 'generate',
        component: () => import('@/views/four/generate.vue'),
        meta: { show: false, title: '内容生成', isLink: true, icon: 'icon-chuangjianmoxing' }
      }
    ]
  },
  // 示范应用
  /*
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/fuse',
    name: 'fusion',
    meta: { show: true, title: '示范应用', isLink: false, icon: 'icon-chaoronghe' },
    children: [
      // 示范一任务
      {
        path: '/fuse',
        name: 'fuse',
        component: () => import('@/views/fusion/index.vue'),
        meta: { show: true, title: '示范应用一', isLink: true, icon: 'icon-rongheguanli' }
      },
      // 示范一发送端
      {
        path: '/createFusionSender',
        name: 'createFusionSender',
        component: () => import('@/views/fusion/createSenderTask.vue'),
        // component: () => import('@/views/fusion/test.vue'),
        meta: { show: false, title: '示范应用一发送端任务', isLink: true, reenter: true }
      },
      // 示范一接收端
      {
        path: '/createFusionReceiver',
        name: 'createFusionReceiver',
        component: () => import('@/views/fusion/createReceiverTask.vue'),
        meta: { show: false, title: '示范应用一接收端任务', isLink: true, reenter: true }
      },
      {
        path: '/fusionDetail',
        name: 'fusionDetail',
        component: () => import('@/views/fusion/taskDetail.vue'),
        meta: { show: false, title: '融合任务详情', isLink: true }
      },
      // 示范二
      {
        path: '/fuseGenerate',
        name: 'fuseGenerate',
        component: () => import('@/views/fusion/fuseGenerate.vue'),
        meta: { show: true, title: '示范应用二', isLink: true, icon: 'icon-ronghe' }
      },
      // 示范二发送端
      {
        path: '/generateSender',
        name: 'generateSender',
        component: () => import('@/views/fusion/generateSender.vue'),
        meta: { show: false, title: '示范应用二发送端', isLink: true, rennter: true }
      },
      // 示范二接收端
      {
        path: '/generateReceiver',
        name: 'generateReceiver',
        component: () => import('@/views/fusion/generateReceiver.vue'),
        meta: { show: false, title: '示范应用二接收端', isLink: true, rennter: true }
      },
      // 示范三 - web端
      {
        path: '/informationFeedback',
        name: 'informationFeedback',
        component: () => import('@/views/fusion/informationFeedback.vue'),
        meta: { show: true, title: '示范应用三 - Web端', isLink: true, icon: 'icon-ronghepingtai' }
      },
      {
        path: '/informationCreate',
        name: 'informationCreate',
        component: () => import('@/views/fusion/inforMationCreate.vue'),
        meta: { show: false, title: 'Web端创建任务', isLink: true, reenter: true }
      },
      // 示范三 - 客户端
      {
        path: '/informationUser',
        name: 'informationUser',
        component: () => import('@/views/fusion/informationUser.vue'),
        meta: { show: true, title: '示范应用三 - 客户端', isLink: true, icon: 'icon-ronghepingtai' }
      },
      // 示范三 - 服务端
      {
        path: '/informationManager',
        name: 'informationManager',
        component: () => import('@/views/fusion/informationManager.vue'),
        meta: { show: true, title: '示范应用三 - 服务端', isLink: true, icon: 'icon-ronghepingtai' }
      },
      // 示范四 - 管理端任务列表
      {
        path: '/hiddenList',
        name: 'hiddenList',
        component: () => import('@/views/fusion/hiddenList.vue'),
        meta: { show: true, title: '示范应用四 - 管理端', isLink: true, icon: 'icon-shujumokuai' }
      },
      // 示范四 - 管理端创建任务
      {
        path: '/hiddenCreate',
        name: 'hiddenCreate',
        component: () => import('@/views/fusion/hiddenCreate.vue'),
        meta: { show: false, title: '示范应用四 - 后台', isLink: true, reenter: true }
      },
      // 示范四 - 用户端
      {
        path: '/hiddenUser',
        name: 'hiddenUser',
        component: () => import('@/views/fusion/hiddenUser.vue'),
        meta: { show: true, title: '示范应用四 - 用户端', isLink: true, icon: 'icon-shujumokuai' }
      }
    ]
  },
  */
  // 示范应用一
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/fuse',
    name: 'fuse',
    meta: { show: true, title: '即时通讯软件"点对点"隐写隐蔽通信工具', isLink: true, icon: 'icon-chaoronghe' },
    children: [
      // 示范一任务
      {
        path: '/fuse',
        name: 'fuse',
        component: () => import('@/views/fusion/index.vue'),
        meta: { show: false, title: '示范应用一任务', isLink: true, icon: 'icon-rongheguanli' }
      },
      // 示范一发送端
      {
        path: '/createFusionSender',
        name: 'createFusionSender',
        component: () => import('@/views/fusion/createSenderTask.vue'),
        // component: () => import('@/views/fusion/test.vue'),
        meta: { show: false, title: '示范应用一发送端任务', isLink: true, reenter: true }
      },
      // 示范一接收端
      {
        path: '/createFusionReceiver',
        name: 'createFusionReceiver',
        component: () => import('@/views/fusion/createReceiverTask.vue'),
        meta: { show: false, title: '示范应用一接收端任务', isLink: true, reenter: true }
      }
    ]
  },
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/fuseGenerate',
    name: 'fuseGenerate',
    meta: { show: true, title: '社交网络信道"一对多"隐写隐蔽通信工具', isLink: true, icon: 'icon-chaoronghe' },
    children: [
      // 示范二
      {
        path: '/fuseGenerate',
        name: 'fuseGenerate',
        component: () => import('@/views/fusion/fuseGenerate.vue'),
        meta: { show: false, title: '示范应用二', isLink: true, icon: 'icon-ronghe' }
      },
      // 示范二发送端
      {
        path: '/generateSender',
        name: 'generateSender',
        component: () => import('@/views/fusion/generateSender.vue'),
        meta: { show: false, title: '示范应用二发送端', isLink: true, rennter: true }
      },
      // 示范二接收端
      {
        path: '/generateReceiver',
        name: 'generateReceiver',
        component: () => import('@/views/fusion/generateReceiver.vue'),
        meta: { show: false, title: '示范应用二接收端', isLink: true, rennter: true }
      }
    ]
  },
  // 示范应用三
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/informationFeedback',
    name: 'feedbackInformation',
    meta: { show: true, title: '伪装Web服务"多对一"情报回传工具', isLink: false, icon: 'icon-chaoronghe' },
    children: [
      // 示范三 - web端
      {
        path: '/informationFeedback',
        name: 'informationFeedback',
        component: () => import('@/views/fusion/informationFeedback.vue'),
        meta: { show: true, title: '示范应用三 - Web端', isLink: true, icon: 'icon-ronghepingtai' }
      },
      {
        path: '/informationCreate',
        name: 'informationCreate',
        component: () => import('@/views/fusion/inforMationCreate.vue'),
        meta: { show: false, title: 'Web端创建任务', isLink: true, reenter: true }
      },
      // 示范三 - 客户端
      {
        path: '/informationUser',
        name: 'informationUser',
        component: () => import('@/views/fusion/informationUser.vue'),
        meta: { show: true, title: '示范应用三 - 客户端', isLink: true, icon: 'icon-ronghepingtai' }
      },
      // 示范三 - 服务端
      {
        path: '/informationManager',
        name: 'informationManager',
        component: () => import('@/views/fusion/informationManager.vue'),
        meta: { show: true, title: '示范应用三 - 服务端', isLink: true, icon: 'icon-ronghepingtai' }
      },
    ]
  },
  // 示范应用四
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/hiddenList',
    name: 'listHidden',
    meta: { show: true, title: '伪装Web服务隐蔽通信参数更新工具', isLink: false, icon: 'icon-chaoronghe' },
    children: [
      // 示范四 - 管理端任务列表
      {
        path: '/hiddenList',
        name: 'hiddenList',
        component: () => import('@/views/fusion/hiddenList.vue'),
        meta: { show: true, title: '示范应用四 - 管理端', isLink: true, icon: 'icon-shujumokuai' }
      },
      // 示范四 - 管理端创建任务
      {
        path: '/hiddenCreate',
        name: 'hiddenCreate',
        component: () => import('@/views/fusion/hiddenCreate.vue'),
        meta: { show: false, title: '示范应用四 - 后台', isLink: true, reenter: true }
      },
      // 示范四 - 用户端
      {
        path: '/hiddenUser',
        name: 'hiddenUser',
        component: () => import('@/views/fusion/hiddenUser.vue'),
        meta: { show: true, title: '示范应用四 - 用户端', isLink: true, icon: 'icon-shujumokuai' }
      }
    ]
  },
  // 隐蔽通联安全性分析工具
  {
    path: '',
    component: () => import('@/components/layout/index.vue'),
    redirect: '/analysis',
    name: 'analysision',
    meta: { show: true, title: '可证安全隐写算法性能及安全性测评工具', isLink: false, icon: 'icon-fenxi' },
    children: [
      {
        path: '/analysis',
        name: 'analysis',
        meta: { show: true, title: '隐写算法安全性测评任务', isLink: true, icon: 'icon-ronghefenxi' },
        component: () => import('@/views/analysis/index.vue')
      },
      {
        path: '/createAnalysis',
        name: 'createAnalysis',
        component: () => import('@/views/analysis/createAnalysis.vue'),
        meta: { show: false, title: '创建测评任务', isLink: true, icon: 'icon-ronghefenxi', exclude: true }
      }
    ]
  }
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [...constantRoutes]
})

export default router
